Skip to content

AINATIVEM-41: CLI tool foundation — create-pipedrive-app scaffold#1

Merged
dmitriyeff merged 30 commits into
masterfrom
AINATIVEM-41
May 11, 2026
Merged

AINATIVEM-41: CLI tool foundation — create-pipedrive-app scaffold#1
dmitriyeff merged 30 commits into
masterfrom
AINATIVEM-41

Conversation

@dmitriyeff
Copy link
Copy Markdown
Contributor

@dmitriyeff dmitriyeff commented May 8, 2026

Summary

  • Bootstraps the create-pipedrive-app CLI tool: project scaffold, interactive prompts, programmatic code generators, and GitHub Actions CI
  • Running npx create-pipedrive-app my-app collects choices via Clack prompts (project name, database, App Extensions, webhooks) and generates a production-ready TypeScript project
  • Generated project passes tsc --noEmit out of the box — validated by an end-to-end test in the suite

What to review

Interactive prompts (src/prompts/)

  • Each prompt module handles the cancel (Ctrl+C) path cleanly via process.exit(0)
  • appExtensions.ts has a two-step flow: confirm → conditional multi-select

Generator interface (src/generators/interface.ts)

  • Language-agnostic GeneratorOptions and Generator interface shared by all generators
  • PHP slot is already stubbed (src/generators/php/index.ts) for a future ticket

Node generator (src/generators/node/)

  • app.ts generator has conditional import/mount logic for webhooks, custom-panel, and custom-modal — worth checking the string interpolation approach
  • index.ts orchestrator conditionally skips webhooks/app-extensions generation and docker-compose based on user choices
  • Root project files generated: package.json, tsconfig.json, .env.example, docker-compose.yml (postgres/mysql only)

writeFile utility (src/utils/writeFile.ts)

  • Runs prettier over all generated files before writing; falls back to raw content for extensions prettier can't parse (e.g. .env.example)

CI (.github/workflows/ci.yml)

  • Runs npm cinpm run lintnpm test on every push and PR to master

What to test

npm install
npm test          # 35 tests across 11 files — includes e2e tsc --noEmit check (~25s)
npm run lint
npm run typecheck

To test the CLI interactively:

npx tsx src/cli.ts

Then answer the prompts and inspect the generated folder — it should contain a working TypeScript Express project that passes tsc --noEmit after npm install.

Example:
Screenshot 2026-05-08 at 14 35 19

Notes

  • Package is not yet published to npm — publishing is deferred until approved
  • Before publishing: add "files": ["dist"] to package.json and a #!/usr/bin/env node shebang to src/cli.ts

Copilot AI review requested due to automatic review settings May 8, 2026 11:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bootstraps the create-pipedrive-app CLI scaffold: interactive prompt flow, Node/TypeScript project generators, a formatting/write utility, and repo-level lint/test/CI configuration to validate generated output.

Changes:

  • Added Clack-based prompt modules (project name, DB, app extensions, webhooks) with unit tests.
  • Implemented a Node generator that writes a minimal Express/TS project scaffold, plus generator unit tests and an e2e tsc --noEmit check.
  • Added repo tooling (Vitest, ESLint, Prettier, CI workflow) to support development and validation.

Reviewed changes

Copilot reviewed 31 out of 34 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vitest.config.ts Adds Vitest configuration for Node test environment.
tsconfig.json Adds TypeScript compiler configuration for building the CLI.
src/utils/writeFile.ts Introduces a Prettier-formatted file writer utility used by generators.
src/utils/writeFile.test.ts Adds tests covering formatting behavior and fallback paths.
src/prompts/webhooks.ts Adds a webhooks confirmation prompt with cancel handling.
src/prompts/webhooks.test.ts Tests the webhooks prompt behavior (true/false/cancel).
src/prompts/projectName.ts Adds project name prompt and basic validation.
src/prompts/projectName.test.ts Tests project name prompt behavior and cancel handling.
src/prompts/database.ts Adds database selection prompt (postgres/mysql/sqlite).
src/prompts/database.test.ts Tests database selection prompt options and cancel handling.
src/prompts/appExtensions.ts Adds app extensions prompt (confirm → multiselect) and cancel handling.
src/prompts/appExtensions.test.ts Tests app extensions prompt flow and cancel handling.
src/generators/interface.ts Defines generator options/types and generator interface.
src/generators/php/index.ts Stubs a PHP generator placeholder throwing “not implemented”.
src/generators/node/webhooks.ts Generates a stub webhooks router module.
src/generators/node/webhooks.test.ts Tests webhooks generator output.
src/generators/node/oauth.ts Generates a stub oauth router module.
src/generators/node/oauth.test.ts Tests oauth generator output.
src/generators/node/database.ts Generates a stub database module.
src/generators/node/database.test.ts Tests database generator output.
src/generators/node/appExtensions.ts Generates stub app-extension router modules based on selected types.
src/generators/node/appExtensions.test.ts Tests conditional generation of app-extension stubs.
src/generators/node/app.ts Generates Express app wiring with conditional imports/mounts.
src/generators/node/app.test.ts Tests conditional imports/mounts in generated app.ts.
src/generators/node/index.ts Orchestrates Node project generation and root config file generation.
src/generators/node/index.test.ts Tests full/minimal generation and runs a nested npm install + tsc --noEmit e2e check.
src/cli.ts Adds CLI entrypoint that runs prompts and invokes the Node generator.
package.json Adds CLI package metadata, scripts, dependencies, and bin entry.
package-lock.json Locks dependencies for reproducible installs in CI/dev.
eslint.config.js Adds ESLint flat config using typescript-eslint.
.prettierrc Adds Prettier configuration used by the repo (and potentially by generators).
.gitignore Adds standard ignores for node/dist/env and docs artifacts.
CLAUDE.md Adds contributor guidance and intended architecture notes.
.github/workflows/ci.yml Adds CI workflow running install, lint, and tests on pushes/PRs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/writeFile.ts Outdated
Comment on lines +6 to +9
try {
const config = await resolveConfig(filePath);
formatted = await format(content, { singleQuote: true, ...config, filepath: filePath });
} catch (error) {
Comment thread src/prompts/projectName.ts Outdated
Comment on lines +4 to +10
const value = await clack.text({
message: 'Project name?',
initialValue: initial,
validate: (v) => {
if (!v.trim()) return 'Project name is required';
},
});
Comment thread src/cli.ts Outdated
Comment on lines +12 to +18
const projectName = await promptProjectName(process.argv[2]);
const database = await promptDatabase();
const appExtensions = await promptAppExtensions();
const webhooks = await promptWebhooks();

const outputDir = join(process.cwd(), projectName);

Comment thread src/generators/node/index.test.ts Outdated
Comment on lines +60 to +66
it('generated project passes tsc --noEmit', async () => {
await nodeGenerator.generate(tmpDir, fullOptions);
execSync('npm install', { cwd: tmpDir, stdio: 'pipe' });
expect(() => {
execSync('npx tsc --noEmit', { cwd: tmpDir, stdio: 'pipe' });
}).not.toThrow();
}, 60_000);
Comment thread .github/workflows/ci.yml
Comment thread src/cli.ts
console.log(' npm run dev');
}

main();
Comment thread CLAUDE.md
Comment on lines +18 to +22
The CLI asks for:
- Backend: Node.js/Express, Node.js/Fastify, or PHP/Laravel
- Database: Postgres, MySQL, or SQLite
- App Extensions frontend: React, Vanilla JS, or none
- Webhooks: Yes/No
dmitriyeff and others added 2 commits May 8, 2026 14:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dev app creation folder - app
Comment thread src/generators/node/app.ts Outdated

const app = express();

app.use('/oauth', oauthRouter);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we setup prettier for the cli project as well ? , these lines look a bit not aligned

Copy link
Copy Markdown
Contributor Author

@dmitriyeff dmitriyeff May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier does not format string literals. I will check for the solution that could be used here.

@@ -0,0 +1,7 @@
import type { Generator, GeneratorOptions } from '../interface.js';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe lets remove the php generator placeholder since it's not in the scope of this mission

Copy link
Copy Markdown
Contributor Author

@dmitriyeff dmitriyeff May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to leave it as a marketing before we implement it and show the structure of different generators we can add to the package 😺 we can remove it anytime

Comment thread package.json Outdated
},
"dependencies": {
"@clack/prompts": "^0.9.0",
"fs-extra": "^11.2.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitriyeff i think in newer versions of node they have promise based writeFile functions so maybe we don't need the fs-extra package ? , no strong opinion either way but would be nice if we can have one less dependency if possible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will replace it 👍

@dmitriyeff dmitriyeff merged commit c2b7cbd into master May 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants